home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: const char??
- Date: Mon, 19 Feb 96 19:46:28 GMT
- Organization: none
- Message-ID: <824759188snz@genesis.demon.co.uk>
- References: <31287436.1235873@news.inforamp.net>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <31287436.1235873@news.inforamp.net>
- dsheuman@inforamp.net "Danny Heuman" writes:
-
- >What is a const char? I am getting an error at compile time stating
- >that it can not convert an int to a const char. I'm using strcpy.
-
- That's not very informative - post example code.
-
- The prototype for strcpy() is:
-
- char *strcpy(char *s1, const char *s2);
-
- The compiler is probably telling you that it can't convert an int to
- const char *. strcpy() requires a pointer to a valid string as its second
- argument - make sure you are giving it one.
-
- const char *ptr; declares a pointer to const char. What this means is that
- you can't modify what ptr points to using ptr. In the strcpy() example it
- means that strcpy() doesn't modify what its second argument points to.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-